import { values } from '../../libs/runtime';
import $ from '../common';
Page({
  data: {
    isIphoneX: $.gData().isIphoneX,
    _components_modal_hide:true,

  },
  onLoad(e) {
    this.setData({
      zonecode: wx.getStorageSync('addresscode') || '',
    })    
    this.getinfo()
  },
  onShow() {

  },
  getinfo(){
    $.get('/user/students',{
      zonecode:this.data.zonecode
    },res=>{
      this.setData({
        info:res
      })
    })
  },
  addstudent(){
    this.setData({ _components_modal_hide: false });

  },
  close(){//关闭模态框
    this.setData({ _components_modal_hide: true });
  },
  godetail(e){
      const{uuid='',campus='',type='certify'}=e.currentTarget.dataset
      $.navigateTo(`/address/childdetail?uuid=${uuid}&campus_uuid=${campus}&type=${type}`)
  },
  inputHandler(e){
    const{value}=e.detail
    this.setData({
      name:value
    })
  },
  sumbit(){
    $.post('/user/add/student',{
      name:this.data.name,
      zonecode:this.data.zonecode
    },res=>{
      this.close()
      this.setData({
        name:''
      })
      this.getinfo()
    })
  }
})